package MyApp::CLI::Command;

use Any::Moose;

with qw(
    MooseX::CLI::Command
    MooseX::CLI::Option::Help
    MooseX::CLI::Option::Usage
    MyApp::CLI::Option::Debug
);

use Exception::CLI;


sub run {
    my $self = shift;

    # show usage if not called as subclass (not dispatched)
    if (blessed $self eq __PACKAGE__) {
        Exception::CLI->throw(
            message => "Command not recognized, try $0 help.\n"
        ) if @{ $self->extra_argv };
        $self->show_usage if blessed $self eq __PACKAGE__;
    };

    return $self;
};


1;


=head1 NAME

MyApp::CLI::Command - An example command

=head1 SYNOPSIS

Brief tutorial:

    B<app.pl> B<help> B<intro>

More help:

    B<app.pl> B<help> B<commands>
    B<app.pl> B<help> I<command-name>
